const { Article } = require('../../model/article');
const { Comment } = require('../../model/comment');
module.exports = async (req, res) => {
    const id = req.query.id;
    let article = await Article.findOne({ _id: id }).populate('author');

    let comments = await Comment.find({ aid: id }).populate('uid');

    // res.send('欢迎来到博客详情页面');
    // res.send(article);
    let str = JSON.stringify(article);
    let json = JSON.parse(str);
    let str1 = JSON.stringify(comments);
    let json1 = JSON.parse(str1);
    res.render('home/article', {
        article: json,
        comments: json1
    });
};